package com.project.controller;

import com.project.bean.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@Controller
public class TestController {
    @RequestMapping("test")
    public String test(HttpServletRequest req){
//        绑定
        req.setAttribute("name" ,"刘勇");
        req.setAttribute("age",20);
        List <UserBean> userList=new ArrayList<>();
        userList.add(new UserBean(1,"张三","1234567890"));
        userList.add(new UserBean(5,"李四","5433117890"));
        userList.add(new UserBean(3,"王五","5123417890"));
        userList.add(new UserBean(6,"赵六","1212167890"));
        userList.add(new UserBean(8,"张刘","1213167890"));
        req.setAttribute("list",userList);
//        请求转发到指定页面
        return "/showInfo.html";

    }

}
